import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkinglotcarVO, ParkinglotcarForm, ParkinglotcarQuery } from '@/api/access/parking-lot/parking-lot-car/types';

/**
 * 查询停车场-车辆列表
 * @param query
 * @returns {*}
 */

export const listParkinglotcar = (query?: ParkinglotcarQuery): AxiosPromise<ParkinglotcarVO[]> => {
  return request({
    url: '/parkinglot/parkingLotCar/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停车场-车辆详细
 * @param parkingLotCarId
 */
export const getParkinglotcar = (parkingLotCarId: string | number): AxiosPromise<ParkinglotcarVO> => {
  return request({
    url: '/parkinglot/parkingLotCar/' + parkingLotCarId,
    method: 'get'
  });
};

/**
 * 新增停车场-车辆
 * @param data
 */
export const addParkinglotcar = (data: ParkinglotcarForm) => {
  return request({
    url: '/parkinglot/parkingLotCar',
    method: 'post',
    data: data
  });
};




/**
 * 修改停车场-车辆
 * @param data
 */
export const updateParkinglotcar = (data: ParkinglotcarForm) => {
  return request({
    url: '/parkinglot/parkingLotCar',
    method: 'put',
    data: data
  });
};

/**
 * 删除停车场-车辆
 * @param parkingLotCarId
 */
export const delParkinglotcar = (parkingLotCarId: string | number | Array<string | number>) => {
  return request({
    url: '/parkinglot/parkingLotCar/' + parkingLotCarId,
    method: 'delete'
  });
};

/**
 * 添加同位车
 * @param data
 */
export const addLotAppositiveCar = (data: ParkinglotcarForm) => {
  return request({
    url: '/parkinglot/parkingLotCar/addAppositiveCar',
    method: 'post',
    data: data
  });
};

